package Thread;

/**
 * 获取栈方法列表
 * @author liyl
 *
 */
public class A {
	public A() {
	}

	private static void printStackTrace() {
		StackTraceElement[] stackElements = new Throwable().getStackTrace();
		if (stackElements != null) {
			for (int i = 0; i < stackElements.length; i++) {
				System.out.println("" + stackElements[i]);
			}
		}
	}

	public void methodA() {
		methodB();
	}

	public void methodB() {
		printStackTrace();
	}

	public static void main(String[] argv) {
		A a = new A();
		a.methodA();
	}
}
